 ///
 /// @file    Point.cc
 /// @author  lemon(haohb13@gmail.com)
 /// @date    2016-02-29 11:24:47
 ///
 
#include <iostream>

using std::cout;
using std::endl;


class Point
{
public:
#if 1
	Point()
	{
		cout << "Point()" << endl;
	}
#endif

	Point(int ix, int iy)
	: _ix(ix)
	, _iy(iy)
	{
		cout << "Point(int,int)" << endl;
		static int iCount = 0;
		++iCount;//效率更高
		//iCount++;
		cout << "调用 " << iCount << "次构造函数" << endl;
	}

	~Point()
	{
		cout << "~Point()" << endl;
	}

	void setX(int ix)
	{
		_ix = ix;
	}

	void setY(int iy)
	{
		_iy = iy;
	}

	void print() 
	{
		cout << "(" << _ix 
			 << "," << _iy
			 << ")" << endl;
	}

	void print() const
	{
		cout << "const->(" << _ix 
			 << "," << _iy
			 << ")" << endl;
	}
private:
	int _ix;
	int _iy;
};

int main(void)
{
	//Point ptArr1[2];//调用默认构造函数初始化数组
	//Point pt1(1,2);
	
	Point ptArr2[2] = {Point(1, 2), Point(3, 4)};//匿名对象
	Point ptArr3[] = {Point(1, 2), Point(3, 4)};
	Point ptArr4[5] = {Point(1, 2), Point(3, 4)};
}
